package com.qcheng.shareprefence;

import android.content.Context;
import android.content.SharedPreferences.Editor;

/**
 * 实现标记的写入和读取
 * 
 * @author 伊斯坦堡
 * 
 */
public class ShareUtils {
	private static String FILE_NAME = "dianping";
	private static String MODE_NAME = "welcome";

	/**
	 * 获取boolean类型的值
	 * 
	 * @param context
	 * @return
	 */
	public static boolean getWelcomeBoolean(Context context) {
		return context.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE)
				.getBoolean(MODE_NAME, false);
	}

	/**
	 * 写入boolean的值
	 * 
	 * @param context
	 * @param isFirst
	 */
	public static void putWelcomeBoolean(Context context, boolean isFirst) {
		Editor editor = context.getSharedPreferences(FILE_NAME,
				Context.MODE_PRIVATE).edit();
		editor.putBoolean(MODE_NAME, isFirst);
		editor.commit();
	}
}
